<template lang="pug">
  kalix-dialog.user-add(title='添加' bizKey="HotlistsAnchor" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="推荐主播" prop="cid" v-bind:label-width="labelWidth" v-bind:rules="rules.uname")
        kalix-select(v-model="formModel.uname" v-bind:requestUrl="userURL"  placeholder="请选择主播"
        v-bind:paramObj="userParam" v-bind:defaultSelect="true" v-on:selectChange="setGroup")
</template>

<script type="text/ecmascript-6">
  import {HotlistsAnchorURL, userURL} from '../../config.toml'
  import EventBus from '../../../../../components/corelib/common/eventbus'
  import FormModel from './model'

  export default {
    name: 'HotlistsAnchorAdd',
    data() {
      return {
        formModel: Object.assign({}, FormModel),
        labelWidth: '170px',
        rules: {
          cid: [{required: true, message: '请输入原住院人数', trigger: 'change'}]
        },
        targetURL: HotlistsAnchorURL,
        userURL: userURL,
        userParam: undefined,
        options: []
      }
    },
    methods: {
      submitAfter() {
        console.log('+++++++++++++++++++')
        this.$nextTick(() => {
          EventBus.$emit('mess')
        })
      },
      init(dialogOption) {
        console.log('---------dialogOption------------', dialogOption)
      },
      setGroup(item) {
        this.formModel.uid = item.id
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">
  .el-form
    width 70%
    margin auto
    .short
      width 38%
      display inline-block
      height 40px
    .el-input
      width 70%
    .radio
      margin-left 20px
      .el-radio
        color: #3465cb
        font-weight: bold
        font-size: 14px

</style>
